package world.liquor.service;

import java.sql.SQLException;
import java.util.ArrayList;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import world.liquor.dao.BeerAssessmentDAOImpl;
import world.liquor.domain.BeerAssessment;


@Service
public class BeerAssessmentService {
	
	private BeerAssessmentDAOImpl dao;
	@Autowired
	public BeerAssessmentService(BeerAssessmentDAOImpl dao){
		this.dao = dao;
	}
	
	
	//평가정보 조회: by 회원id & 맥주id
	public BeerAssessment selectAssessmentByMemberAndBeerId(String memberId, String beerInfoId) throws SQLException{
		return (BeerAssessment)dao.selectBeerAssessmentByMemberAndBeerId(memberId, beerInfoId);
	}
	
	//평가정보 조회: by 회원id & 맥주id
	public ArrayList<BeerAssessment> selectAssessmentByMemberId(String memberId) throws SQLException{
		return (ArrayList<BeerAssessment>)dao.selectBeerAssessmentByMemberId(memberId);
	}
	
	//모든 맥주평가 조회
	public ArrayList<BeerAssessment> selectAllBeerAssessment() throws SQLException{
		ArrayList<BeerAssessment> list = dao.selectAllBeerAssessment();
		return list;
	}
	
	//회원의 맥주에 대한 평가 등록
	public void registerAssessment(BeerAssessment assess) throws SQLException{
		dao.insertBeerAssessment(assess);
	}
	
	//회원의 맥주에 대한 평가 수정
	public void updateAssessment(BeerAssessment assess) throws SQLException{
		dao.updateBeerAssessment(assess);
	}
	
	//회원의 맥주에 대한 평가 삭제
	public void deleteAssessment(int assessId) throws SQLException{
		dao.deleteBeerAssessment(assessId);
	}
	
	
	
	
}
